<template>
	<view>
		<!-- #ifdef MP-WEIXIN -->
		<web-view :src="url"></web-view>
		<!-- #endif -->
	</view>
</template>

<script>
	import base64 from '../../../common/base64.js';
export default {
	data() {
		return {
			url: '',
			customStyle: {
				background: 'linear-gradient(rgb(161,211,255), rgb(59,162,255))',
				width: '80%',
				color: '#f1f1f1',
				padding: '40rpx 0',
				fontSize: '12pt'
			},
			show: false,
			status: false // 显示状态
		};
	},
	onLoad() {
		// #ifdef MP-WEIXIN
		uni.showShareMenu({
			withShareTicket: true,
			menus: ['shareAppMessage', 'shareTimeline']
		});
		// #endif
		this.onPageInit();
	},
	onShow() {
		this.onPageInit();
	},
	methods: {
		onPageInit() {
			let obj = uni.getStorageSync('live');
			this.$tkRequest('/api/User/userInfo').then(res => {
				let info = res.data;
				// #ifdef MP-WEIXIN
				this.url = `${obj.watch_url}&tuid=${info.user_id}&nickname=${encodeURIComponent(base64.encode(info.username))}&avatar=${info.photo}`;
				// #endif
				// #ifdef H5
				location.href = `${obj.watch_url}&tuid=${info.user_id}&nickname=${encodeURIComponent(base64.encode(info.username))}&avatar=${info.photo}`;
				// #endif
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.view {
	position: fixed;
	right: $uni-spacing-row-lg;
	top: 10vh;
	z-index: 10000;
	display: flex;
	flex-direction: column;
	align-items: center;
}
.popup {
	width: 80vw;
	padding: $uni-spacing-col-lg $uni-spacing-row-lg;
	background-image: url();
	background-size: cover;
	background-position: center;

	.title {
		display: inline-block;
		padding: 60rpx 0 30rpx 0;
		color: #f1f1f1;
		font-size: 1rem;
	}

	.qu {
		padding: $uni-spacing-col-lg 0;
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
	}
}
</style>
